﻿using System;
using System.Data;
using System.Collections.Generic;
using eTMS.Controllers.DiemDanhSinhVienService;
namespace eTMS.Controllers{
public class DiemDanhSinhVienControllerBase : CommonController{
	public DiemDanhSinhVienControllerBase()
		: base()
	{	
		this.dao = new DiemDanhSinhVienServiceClient();
	}
	protected DiemDanhSinhVienServiceClient dao;
	~DiemDanhSinhVienControllerBase(){
		try{dao.Close();}catch{}
	}
    //Copy data from data row in grid to object
    public DiemDanhSinhVienEntity MapDataRowToObject(DataRow row){
		DiemDanhSinhVienEntity o = new DiemDanhSinhVienEntity();
		 if(!row.IsNull("NgayDiemDanh"))
			o.NgayDiemDanh=ConvertDateTime(row["NgayDiemDanh"]);
		 if(!row.IsNull("User_ID"))
			o.User_ID=ConvertInt(row["User_ID"]);
		 if(!row.IsNull("NamHoc_ID"))
			o.NamHoc_ID=ConvertInt(row["NamHoc_ID"]);
		 if(!row.IsNull("HocKy_ID"))
             o.HocKy_ID = ConvertInt(row["HocKy_ID"]);
         if (!row.IsNull("Lop_ID"))
             o.Lop_ID = (Int32)(row["Lop_ID"]);
		 if(!row.IsNull("DiemDanhSinhVien_ID"))
		    o.DiemDanhSinhVien_ID=(Int32)(row["DiemDanhSinhVien_ID"]);
		 return o;
    }
	//Copy data from object to data row in grid    
    public void MapObjectToDataRow(DiemDanhSinhVienEntity o,DataRow row){
		row["NgayDiemDanh"]=o.NgayDiemDanh;
		row["User_ID"]=o.User_ID;
		row["NamHoc_ID"]=o.NamHoc_ID;
		row["HocKy_ID"]=o.HocKy_ID;
		row["DiemDanhSinhVien_ID"]=o.DiemDanhSinhVien_ID;
    }
}
}
